package designs.models.surface.example.one;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.StringReader;

public class WriteFile {
	public void writeToFile(String fileName,String content) {
		try {
			StringReader fileReader = new StringReader(content);
			BufferedReader bfr = new BufferedReader(fileReader);
			FileWriter fileWriter = new FileWriter(fileName);
			BufferedWriter bw = new BufferedWriter(fileWriter);
			String s = null;
			while ((s = bfr.readLine()) != null) {
				bw.write(s);
				bw.newLine();
				bw.flush();
			}
			bfr.close();
			fileReader.close();
			bw.close();
			fileWriter.close();
			
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}
